#lang sicp

(define (square x)
  (* x x))

(define (fast-expt a n)
  (cond ((= n 0) 1)
        ((odd? n) (* a (square (fast-expt a (quotient n 2)))))
        (else (square (fast-expt a (quotient n 2))))))

(fast-expt 5 10)